When attempting to run ./configure with a standard bunch of options today, I kept getting the error above. I decided to exactly mimic the configure options I had used on a previous successful build of PHP on a different server and the php configure script still died. This is the configure command I was trying to use:
'./configure' '--with-apxs2=/usr/local/apache2/bin/apxs' \
'--with-zlib-dir=../zlib-1.2.3/' \
'--with-pdo-mysql=/usr/local/mysql' \
'--with-mysql=/usr/local/mysql'
This was on php 5.2.3, whereas today's build was on php 5.2.4. I have pasted that straight off the phpinfo screen - it doesn't work any more!
I did get configure to work however by opening up the mysql path which the --with-pdo-mysql= bit is pointing to. This configure then worked:
./configure
--with-apxs2=/usr/local/apache2/bin/apxs
--with-mysql
--enable-pdo
--with-zlib-dir=../zlib-1.2.3
--with-pdo-mysql=/usr/local
The only problem them was that the compile stage failed. The error reported by make looked like this:
/usr/src/php-5.2.4/ext/pdo_mysql/mysql_driver.c:33:26: mysqld_error.h: No such file or directory
In file included from /usr/src/php-5.2.4/ext/pdo_mysql/mysql_driver.c:40:
/usr/src/php-5.2.4/ext/pdo_mysql/php_pdo_mysql_sqlstate.h: In function `pdo_mysql_get_sqlstate':
/usr/src/php-5.2.4/ext/pdo_mysql/php_pdo_mysql_sqlstate.h:378: `WARN_DATA_TRUNCATED' undeclared (first use in this function)
/usr/src/php-5.2.4/ext/pdo_mysql/php_pdo_mysql_sqlstate.h:378: (Each undeclared identifier is reported only once
/usr/src/php-5.2.4/ext/pdo_mysql/php_pdo_mysql_sqlstate.h:378: for each function it appears in.)
make: *** [ext/pdo_mysql/mysql_driver.lo] Error 1
Well look at that. It appears that the mysqld_error.h file which is required to compile the mysql_driver.c couldn't be found. I'll run locate to see where that file is located:
% updatedb && locate mysqld_error.h
/usr/src/php-4.4.1/ext/mysql/libmysql/mysqld_error.h
/usr/local/mysql/include/mysqld_error.h
%
So the file is definitely there under the mysql path, but the build process isn't finding it and it's not packaged in the /ext/pdo_mysql directory. This would appear to be a bug to me. The only way to fix this and get php with pdo-mysql to compile would be to copy that file over:
% cp /usr/src/mysql-5.0.37/include/mysqld_error.h /usr/src/php-5.2.4/ext/pdo_mysql/.
With that header file now in place, php compiles just fine.
christo